//
//  MJHomeViewModel.m
//  MJ
//
//  Created by lina on 2017/12/1.
//  Copyright © 2017年 lina. All rights reserved.
//
#define API_Home  MJ_DOMAINURL@"minapp/lovetest/list.php"




#import "MJHomeViewModel.h"
#import "MJNetWorkTool.h"
#import "MJHomeModel.h"
#import <YYKit.h>
#import "MJHomeCarouseModel.h"

@implementation MJHomeViewModel

+(void)requestHomeListDataWithPage:(NSInteger)page Success:(void (^) (MJHomeModel*homeModel))requestSuccess failure:(void(^)(NSError *error))requestFailure netWorkState:(void (^) (BOOL netWorkState))netWorkState{
    
    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
    [dic setObject:[NSString stringWithFormat:@"%ld",page] forKey:@"page"];
    [[MJNetWorkTool sharedUtil] requestAFURL:API_Home httpMethod:1 parameters:dic succeed:^(id dict) {
        if ([[dict objectForKey:@"flag"] isEqualToString:@"001"]) {
            
            MJHomeModel *model = [MJHomeModel modelWithDictionary:[dict objectForKey:@"content"]];
            requestSuccess(model);
        }else{
            requestFailure (dict);

        }
    } failure:^(NSError *err) {
        requestFailure (err);
    }];
}


/** 首页的轮播图 */
+(void)requestHomeCarouseListDataSuccess:(void (^) (NSArray <MJHomeCarouseModel *> *carouseArr))requestSuccess failure:(void(^)(NSError *error))requestFailure netWorkState:(void (^) (BOOL netWorkState))netWorkState{
    


}
@end
